import request from '@/utils/request'

// // 接口代理前缀
// const api_prefix = process.env.VUE_APP_COLLEXT

export const upload_file = (params,flag)=>{ 
  return new Promise(async (resolve,reject) =>{
    request.post('/resource/fileupload/upload',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

/**
 * U3D场景列表
 * @param {*} params 
 * @returns 
 */
 export const getArSceneList = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/arscene/list',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const add_adPlace = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/api/adPlace/addAdPlacer',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const get_adPlace_list = (params)=>{
    return new Promise(async (resolve,reject) =>{
      request.post('/api/adPlace/listPageAdPlacer',params).then(res=>{
        resolve(res)
      }).catch(err=>{
        resolve(err)
      })
    })
}

export const del_adPlace = (adPlaceId)=>{
  return new Promise(async (resolve,reject) =>{
    request.get(`/api/adPlace/removeAdPlacer/${adPlaceId}`).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const edit_adPlace = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post(`/api/adPlace/editAdPlacer`,params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const get_adPlace_detail = (adPlaceId)=>{
  return new Promise(async (resolve,reject) =>{
    request.get(`/api/adPlace/detailAdPlacer/${adPlaceId}`).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const add_arLandmark = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/arLandmark/add',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const get_Landmark_details = (arLandmarkId)=>{  
  return new Promise(async (resolve,reject) =>{
    request.get(`/boss/arLandmark/detail/${arLandmarkId}`).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}
export const edit_Landmark_data = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/arLandmark/update',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}
export const get_landmark_list = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/arLandmark/list',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}
export const del_Landmark_data = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/arLandmark/delete',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}
export const get_area_list = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/area/list',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const get_sub_area_list = (params)=>{
  return new Promise(async (resolve,reject) =>{
    let fromData = new FormData()
    for (const key in params) {
      params[key] && fromData.append(key, params[key])
    }
    request.post('/boss/area/node-by-pid',fromData).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const add_area = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/area/add',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}
export const edit_area = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/area/update',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}
export const del_area = (params)=>{
  return new Promise(async (resolve,reject) =>{
    let fromData = new FormData()
    for (const key in params) {
      params[key] && fromData.append(key, params[key])
    }
    request.post('/boss/area/delete',fromData).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}
//------------商铺-----------

export const get_shop_list = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/shop/list',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}
export const add_shop = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/shop/add',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const edit_shop = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/shop/update',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const get_shop_details = (shopId)=>{
  return new Promise(async (resolve,reject) =>{
    request.get(`/boss/shop/detail/${shopId}`).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const del_shop = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/shop/delete',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const get_prop_list = (params)=>{
  return new Promise(async (resolve,reject) =>{
    let fromData = new FormData()
    for (const key in params) {
      params[key] && fromData.append(key, params[key])
    }
    request.post('/boss/arprop-boss/arprop-list',fromData).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const add_prop = (params)=>{
  return new Promise(async (resolve,reject) =>{
    let fromData = new FormData()
    for (const key in params) {
      fromData.append(key, params[key])
    }
    request.post('/boss/arprop-boss/arprop-add',fromData).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const edit_prop = (params)=>{
  return new Promise(async (resolve,reject) =>{
    let fromData = new FormData()
    for (const key in params) {
      fromData.append(key, params[key])
    }
    request.post('/boss/arprop-boss/arprop-edit',fromData).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const del_prop = (arPropId)=>{
  return new Promise(async (resolve,reject) =>{
    let fromData = new FormData()
    fromData.append('arPropId', arPropId)
    request.post('/boss/arprop-boss/arprop-delete',fromData).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const get_prop_detail = (params)=>{
  return new Promise(async (resolve,reject) =>{
    let fromData = new FormData()
    for (const key in params) {
      fromData.append(key, params[key])
    }
    request.post('/boss/arprop-boss/arprop-detail-boss',fromData).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

//----卡片管理-----
export const get_card_list = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/card/listPageCard',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const get_card_status_number = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.get('/boss/card/groupCountStatus').then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const add_card = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/card/addCard',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const get_card_detail = (cardId)=>{
  return new Promise(async (resolve,reject) =>{
    request.get(`/boss/card/getCardDetail/${cardId}`).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const edit_card = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/card/updateCard',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const del_card = (cardId)=>{
  return new Promise(async (resolve,reject) =>{
    request.get(`/boss/card/deleteCard/${cardId}`).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}
//------------活动------------
export const get_activity_list = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/activity/listPageActivity',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const add_activity = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/activity/addActivity',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const get_activity_detail = (activityId)=>{
  return new Promise(async (resolve,reject) =>{
    request.get(`/boss/activity/getDetail/${activityId}`).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const edit_activity = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/activity/updateActivity',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

//--------------锻造------------------

export const get_forget_list = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/nft/born/list',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const add_forget = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/nft/born/create',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const del_forget = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/nft/born/delete',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const done_forget = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/nft/born/born',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const get_forget_detail = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/nft/born/queryDetail',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const destroy_forget = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/nft/born/destroyNft',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const apply_auction = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/nft/born/bidRelease',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const apply_sell = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/nft/born/consignmentRelease',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

//--------交易---------
export const get_trade_list = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/nft/trade/list',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const get_trade_detail = (sellRecordId)=>{
  return new Promise(async (resolve,reject) =>{
    request.get(`/boss/nft/trade/tradeDetail/${sellRecordId}`).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const get_bidLog_list = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/nft/trade/bidLogList',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const get_ad_release_list = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/adPlace/record/listPageAdPlaceJobRecordBoss',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}
export const get_ad_release_detail = (adPlaceJobRecordId)=>{
  return new Promise(async (resolve,reject) =>{
    request.post(`/boss/adPlace/record/adPlaceJobRecordDetailsBoss/${adPlaceJobRecordId}`).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}
export const get_ads_award_record = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/adPlace/record/listPageAdPlaceAwardRecordBoss',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}
export const get_complaint_record = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/adPlace/complaint/listPageComplaintRecord',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}
export const get_complaint_detail = (complaintRecordId)=>{
  return new Promise(async (resolve,reject) =>{
    request.post(`/boss/adPlace/complaint/detailComplaintRecord/${complaintRecordId}`).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const complaint_sentence = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/adPlace/complaint/auditComplaintRecord',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const get_order_list = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/mall/order/listPageMallOrder',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

//-----------------------

export const get_article_list = (params)=>{
  return new Promise(async (resolve,reject) =>{
    let fromData = new FormData()
    for (const key in params) {
      params[key] && fromData.append(key, params[key])
    }
    request.post('/api/articles-api/articles-list',fromData).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const get_article_detail = (params)=>{
  return new Promise(async (resolve,reject) =>{
    let fromData = new FormData()
    for (const key in params) {
      params[key] && fromData.append(key, params[key])
    }
    request.post('/api/articles-api/articles-get',fromData).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const add_article = (params)=>{
  return new Promise(async (resolve,reject) =>{
    let fromData = new FormData()
    for (const key in params) {
      params[key] && fromData.append(key, params[key])
    }
    request.post('/boss/articles/add_item',fromData).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}
export const edit_article = (params)=>{
  return new Promise(async (resolve,reject) =>{
    let fromData = new FormData()
    for (const key in params) {
      params[key] && fromData.append(key, params[key])
    }
    request.post('/boss/articles/update_item',fromData).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const del_article = (params)=>{
  return new Promise(async (resolve,reject) =>{
    // let fromData = new FormData()
    // for (const key in params) {
    //   params[key] && fromData.append(key, params[key])
    // }
    request.post('/boss/articles/delete_item',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const get_dao_list = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/dao/listPageDaoBoss',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const get_dao_detail = (daoId)=>{
  return new Promise(async (resolve,reject) =>{
    request.get(`/boss/dao/detail/${daoId}`).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}
export const get_dao_member_list = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/dao/listPageDaoMemberBoss',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}
export const get_article_type_list = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.get('/boss/articles/get-all-type').then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const async_map_data = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.get('/api/sync/map').then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const async_scene_data = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.get('/api/sync/scene').then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const get_card_for_aid = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/api/card/listPageCard',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const get_app_goods_list = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/api/goods/list',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}
export const get_ads_release_record = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/adPlace/record/listPageAdPlaceJobRecordBoss',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const get_visit_statistics = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/api/common/visit/getVisitByObjectId',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const get_boos_ads_list = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/adPlace/listPageAdPlacer',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const get_arLandmark_shop_list = (params)=>{
  return new Promise(async (resolve,reject) =>{
    request.post('/boss/shop/shopList',params).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}

export const get_user_info_by_walletAddress = (walletAddress)=>{
  return new Promise(async (resolve,reject) =>{
    request.get(`/api/user/query-user-byaddress?walletAddress=${walletAddress}`).then(res=>{
      resolve(res)
    }).catch(err=>{
      resolve(err)
    })
  })
}



